﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="FlashMainTabControlTemplate.xaml"/>
        <ResourceDictionary Source="FlashImages\MessageBubble.xaml"/>
        <ResourceDictionary Source="FlashImages\Home.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <DataTemplate DataType="{x:Type vm:MainViewModel}">
        <DockPanel>
            <Menu DockPanel.Dock="Top" VerticalAlignment="Top" Background="Transparent">
                <MenuItem Header="{c:LocalizedString s_Login}" c:Extensions.Items="{Binding Path=FileMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
                <MenuItem Header="{c:LocalizedString s_View}" c:Extensions.Items="{Binding Path=ViewMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
                <MenuItem Header="{c:LocalizedString s_Tools}" c:Extensions.Items="{Binding Path=ToolsMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
                <MenuItem Header="{c:LocalizedString s_Help}" c:Extensions.Items="{Binding Path=HelpMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
            </Menu>

            <TabControl ItemsSource="{Binding Pages}" BorderThickness="0" Background="White" IsSynchronizedWithCurrentItem="True" Template="{StaticResource MainTabControlTemplate}">

                <TabControl.ItemContainerStyle>
                    <Style TargetType="{x:Type TabItem}">
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="Padding" Value="5"/>
                        <Setter Property="BorderBrush" Value="#9B6E00"/>
                        <Setter Property="BorderThickness" Value="0"/>
                        <Setter Property="Background" Value="Transparent"/>
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type TabItem}">
                                    <ControlTemplate.Resources>
                                        <ResourceDictionary Source="FlashMainTabControlItems.xaml"/>
                                    </ControlTemplate.Resources>

                                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                        <ContentPresenter ContentSource="Header"
                                            HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" 
                                            VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" 
                                            RecognizesAccessKey="True"/>
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="IsSelected" Value="true"/>
                                                <Condition Property="IsMouseOver" Value="true"/>
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Panel.ZIndex" Value="1"/>
                                            <Setter Property="BorderThickness" Value="3, 0, 3, 0"/>
                                            <Setter Property="Background" Value="#C0FFFCE0"/>
                                        </MultiTrigger>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="IsSelected" Value="true"/>
                                                <Condition Property="IsMouseOver" Value="false"/>
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Panel.ZIndex" Value="1"/>
                                            <Setter Property="BorderThickness" Value="3, 0, 3, 0"/>
                                            <Setter Property="Background" Value="#C0FEF188"/>
                                        </MultiTrigger>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="IsSelected" Value="false"/>
                                                <Condition Property="IsMouseOver" Value="true"/>
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Background" Value="#C0FEF188"/>
                                        </MultiTrigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </TabControl.ItemContainerStyle>

            </TabControl>
        </DockPanel>
    </DataTemplate>
</ResourceDictionary>